package com.secret.chain.secretchain.mapper;

import com.secret.chain.secretchain.domain.entity.Address;
import com.secret.chain.secretchain.domain.entity.Article;
import com.secret.chain.secretchain.domain.entity.Like;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface ArticleMapper {
    @Insert("INSERT INTO `like` (user_id, article_id, create_time, update_time, status) VALUES (#{userId},#{articleId},#{creatTime},#{updateTime},#{status})")
    void add(Like like);

    @Select("select * from `chain_article` where group_id = #{groupId}")
    Article queryByGroupId(Integer id);
    @Insert("insert into chain_article (hash_id,chain_address)VALUES(#{hash},#{address})")
    void insert(String hash,String address);
    @Update( "update `chain_article` set hash_id = #{hash} WHERE chain_address = #{address}")
    void put(Address address);
    @Delete( "delete from chain_article where id = #{id}")
    void deleteById(Integer id);
}
